package se19team1e.controller;

import java.awt.event.ActionListener;

import se19team1e.gui.MessageBox;

/**
 * A mock MessageBox, used for testing.
 * 
 * @author lai shiaw san
 *
 */
public class MockMessageBox implements MessageBox {

    /**
     * Flag to indicate the visiblity of the form.
     */
    boolean visible = false;

    /**
     * Flag to indicate disposed is called.
     */
    boolean disposed = false;

    /**
     * Cached parameter from set title.
     */
    String title;

    /**
     * Cached parameter from set message.
     */
    String message;

    /**
     * Cached parameter from set action listener.
     */
    ActionListener actionListener;
    
    /* (non-Javadoc)
     * @see se19team1e.gui.IMessageBox#show()
     */
    @Override
    public void show() {
        this.visible = true;
    }

    /* (non-Javadoc)
     * @see se19team1e.gui.IMessageBox#hide()
     */
    @Override
    public void hide() {
        this.visible = false;
    }

    /* (non-Javadoc)
     * @see se19team1e.gui.IMessageBox#dispose()
     */
    @Override
    public void dispose() {
        this.visible = false;
    }

    /* (non-Javadoc)
     * @see se19team1e.gui.IMessageBox#setTitle(java.lang.String)
     */
    @Override
    public void setTitle( String title ) {
        this.title = title;
    }

    /* (non-Javadoc)
     * @see se19team1e.gui.IMessageBox#setMessage(java.lang.String)
     */
    @Override
    public void setMessage( String message ) {
        System.out.println( "Displaying message: " + message );
        this.message = message;
    }

    /* (non-Javadoc)
     * @see se19team1e.gui.IMessageBox#setActionListener(java.awt.event.ActionListener)
     */
    @Override
    public void setActionListener( ActionListener actionListener ) {
        this.actionListener = actionListener;
    }

}
